package com.tjmc.finance.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.tjmc.finance.mapper.UsageRecordsMapper;
import com.tjmc.finance.service.PlatformUserAccountService;
import com.tjmc.finance.service.UsageRecordsService;
import com.tjmc.recruit.common.core.util.R;
import com.tjmc.recruit.finance.api.entity.PlatformUserAccountEntity;
import com.tjmc.recruit.finance.api.entity.UsageRecordsEntity;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.math.BigDecimal;

/**
 * 消费记录表
 *
 * @author recruit
 * @date 2024-11-25 14:17:34
 */
@Service
@RequiredArgsConstructor
public class UsageRecordsServiceImpl extends ServiceImpl<UsageRecordsMapper, UsageRecordsEntity> implements UsageRecordsService {

    @Override
    @Transactional(rollbackFor = Exception.class)
    public R<Boolean> addUsageRecords(UsageRecordsEntity usageRecordsEntity) {
        // 4. 新增消费信息
        boolean save = save(usageRecordsEntity);
        if (!save) {
            return R.failed("新增消费记录失败");
        }
        return R.ok(Boolean.TRUE);
    }
}
